﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.Entity;
using COM.OA.BLL;

public partial class tzManager_updaz : System.Web.UI.Page
{
    sendword sw = new sendword();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            //从request中取sw_id
            int sw_id = Int32.Parse(this.Request["sw_id"]);
            //放入页面隐藏表单中
            this.txtsw_id.Text = sw_id.ToString();
            //根据ID从数据库中查询信息
            sw = sendwordBLL.Select(sw_id);
            //把信息分别放入文档框中
            this.txtTitle.Text = sw.sw_title;

            this.ftbContent.Text = sw.sw_content;

            this.txtsw_dept_id.Text = sw.sw_dept_id.ToString();

            this.txtuid.Text = sw.sw_u_id.ToString();

            this.txtstate.Text = sw.sw_state.ToString();

            this.txtreads.Text = sw.sw_reads.ToString();
        }

    }

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //从页面去出数据并放入实体
        sw.sw_id = Int32.Parse(this.txtsw_id.Text);

        sw.sw_title = this.txtTitle.Text;

        sw.sw_content = this.ftbContent.Text;

        sw.sw_releasetime = DateTime.Parse(DateTime.Now.ToString());

        sw.sw_dept_id = Int32.Parse(this.txtsw_dept_id.Text);

        sw.sw_u_id = Int32.Parse(this.txtuid.Text);

        sw.sw_state = Int32.Parse(this.txtstate.Text);

        sw.sw_reads = Int32.Parse(this.txtreads.Text);
        //修改数据库中的数据
        sendwordBLL.Update(sw);
        //跳转页面
        this.Response.Redirect("guanlitongzhi.aspx");

    }

    protected void btnselect_Click(object sender, EventArgs e)
    {
        //从页面取值
        string tiaojian = this.txtwhere.Text;
        //放入session
        Session.Add("tiaojian", tiaojian);
        //跳转到查询页面
        this.Response.Write(string.Format(GetRedirect.REDIRECT, "mohuchaxun.aspx"));
    }
    protected void btnQuxiao_Click(object sender, EventArgs e)
    {
        //跳转到上级页面
        this.Response.Write(string.Format(GetRedirect.REDIRECT, "guanlitongzhi.aspx"));
    }
}
